/*
 * Timer.hpp
 *
 *  用as3里面的Timer提供的接口来做这个类
 *
 *  Created on: 2010-4-5
 *      Author: anod
 */

#ifndef TIMER_HPP_
#define TIMER_HPP_

#include <EventSender.hpp>

class Timer:public EventSender
{
public:
	/**
	 * 构造函数：delay 相隔时间毫秒  repeat 重复次数
	 */
	Timer(unsigned int delay, unsigned int repeat=1);

	/**
	 * 开始计时，相当于按下了计时秒表的开始键
	 */
	void start();

	/**
	 * 停止计时，相当于按下了计时秒表的停止键
	 */
	void stop();

	/**
	 * 重新计时，相当于按下了计时秒表的归零键
	 */
	void reset();

	/**
	 * 各种setter和setter
	 */
	void setDelay(unsigned int delay);
	void setRepeat(unsigned int repeat);
	unsigned int getDelay();
	unsigned int getRepeat();
	unsigned int getCurrentCount();
private:
	unsigned int _delay;
	unsigned int _repeat;
	unsigned int _current_count;
};


#endif /* TIMER_HPP_ */
